home *** CD-ROM | disk | FTP | other *** search
- Version 1.00
- BEGIN Form Ctrlpanl
- AutoRedraw = 0
- BackColor = QBColor(7)
- BorderStyle = 1
- Caption = "ControlPanel Properties"
- ControlBox = -1
- Enabled = -1
- ForeColor = QBColor(0)
- Height = Char(11)
- Left = Char(14)
- MaxButton = -1
- MinButton = -1
- MousePointer = 0
- Tag = ""
- Top = Char(3)
- Visible = -1
- Width = Char(44)
- WindowState = 0
- BEGIN HScrollBar HScroll1
- Attached = 0
- DragMode = 0
- Enabled = -1
- Height = Char(1)
- LargeChange = 1
- Left = Char(20)
- Max = 32767
- Min = 0
- MousePointer = 0
- SmallChange = 1
- TabIndex = 5
- TabStop = 0
- Tag = ""
- Top = Char(3)
- Value = 0
- Visible = -1
- Width = Char(12)
- END
- BEGIN VScrollBar VScroll1
- Attached = 0
- DragMode = 0
- Enabled = -1
- Height = Char(5)
- LargeChange = 1
- Left = Char(33)
- Max = 32767
- Min = 0
- MousePointer = 0
- SmallChange = 1
- TabIndex = 4
- TabStop = 0
- Tag = ""
- Top = Char(2)
- Value = 0
- Visible = -1
- Width = Char(1)
- END
- BEGIN CommandButton cmdSelUpdate
- BackColor = QBColor(7)
- Cancel = 0
- Caption = "&Update"
- Default = 0
- DragMode = 0
- Enabled = 0
- Height = Char(3)
- Left = Char(18)
- MousePointer = 0
- TabIndex = 3
- TabStop = -1
- Tag = ""
- Top = Char(6)
- Visible = -1
- Width = Char(12)
- END
- BEGIN CommandButton cmdSelCancel
- BackColor = QBColor(7)
- Cancel = -1
- Caption = "&Cancel"
- Default = 0
- DragMode = 0
- Enabled = -1
- Height = Char(3)
- Left = Char(2)
- MousePointer = 0
- TabIndex = 2
- TabStop = -1
- Tag = ""
- Top = Char(6)
- Visible = -1
- Width = Char(12)
- END
- BEGIN CommandButton cmdSelChange
- BackColor = QBColor(7)
- Cancel = 0
- Caption = "C&hange"
- Default = 0
- DragMode = 0
- Enabled = -1
- Height = Char(3)
- Left = Char(2)
- MousePointer = 0
- TabIndex = 1
- TabStop = -1
- Tag = ""
- Top = Char(2)
- Visible = -1
- Width = Char(12)
- END
- BEGIN ComboBox cboControls
- BackColor = QBColor(7)
- DragMode = 0
- Enabled = -1
- ForeColor = QBColor(0)
- Height = Char(1)
- Left = Char(1)
- MousePointer = 0
- Sorted = 0
- Style = 2
- TabIndex = 0
- TabStop = -1
- Tag = ""
- Top = Char(1)
- Visible = -1
- Width = Char(40)
- END
- END
- '===============================================
- ' PMCTLPNL
- ' Allows updates to ControlPanel properties
- ' and saves the selections in a file
- ' called CTRLPANL.OPT
- '
- ' The original idea for this program came from
- ' the book
- ' VISUAL BASIC for MS-DOS Workshop
- ' by John Clark Craig
- ' published by Microsoft Press
- '
- ' The rest of the ideas are from Robert A. Blaney
- ' Chandero Systems, Inc.
- ' 14 Parkview Rd.
- ' Long Valley, NJ 07853
- '
- ' This program is being termed freeware for the
- ' following reasons:
- ' 1. I learned somethings about VB DOS
- ' 2. I want you to be able to use this and
- ' experiment with it
- ' 3. It will help pay back the work of others
- '
- '===============================================
- DEFINT A-Z
- DECLARE SUB GetColorSelect ()
- DECLARE SUB cmdSelChange_Click ()
- DECLARE SUB UpdateCtrlData ()
- '$INCLUDE: 'CONSTANT.BI'
-
-
- ' The current Control Panel index
- DIM SHARED CtrlIndx AS INTEGER
- ' Switch to indicate some changes were made to controls
- DIM SHARED CtrlChanged AS INTEGER
- ' Switch to indicate that file was saved
- DIM SHARED OutputSaved AS INTEGER
- ' to pass the selected color back
- COMMON SHARED HoldColorIndex AS INTEGER
-
- DIM SHARED PMCtrl AS INTEGER
-
- ' $FORM frmColSelect
- ' $FORM CtrlPanl
-
- SUB cboControls_DblClick ()
- ' User double clicked on the list, invoke the select
- CALL cmdSelChange_Click
- END SUB
-
- SUB cboControls_GotFocus ()
- ' If the color was set then HoldColorIndex
- ' will have a value
- IF HoldColorIndex <> 99 THEN
- ' User selected a color for this item, update it
- CtrlChanged = TRUE
- OutputSaved = NOT CtrlChanged
- Screen.ControlPanel(CtrlIndx) = HoldColorIndex
- HoldColorIndex = 99 ' Done
- END IF
- cmdSelChange.Enabled = TRUE
- cmdSelUpdate.Enabled = CtrlChanged
- END SUB
-
- SUB cmdSelCancel_Click ()
- ' the cmdSelCancel is a DONE button
- ' Check if any changes were made and whether the
- ' output was saved, if not, give one last chance
- IF CtrlChanged AND NOT OutputSaved THEN
- x = MSGBOX("Save the Updates Made?", 3, "File Save")
- IF x = 6 THEN ' Yes
- CALL UpdateCtrlData
- ELSEIF x = 2 THEN
- EXIT SUB
- END IF
- END IF
- UNLOAD frmColSelect
- UNLOAD CtrlPanl
- CLOSE (10)
- END SUB
-
- SUB cmdSelChange_Click ()
- ' User indicated to change the control selected
- ' in the list box, CtrlIndx points to entry in list
- CtrlIndx = cboControls.ListIndex
- IF CtrlIndx < 0 THEN
- cboControls.SETFOCUS
- EXIT SUB ' nothing selected
- END IF
- ' get the current value
- Tmp = Screen.ControlPanel(CtrlIndx)
-
- SELECT CASE CtrlIndx
- CASE 0 TO 2, 4 TO 6, 8 TO 14, 16 TO 17
- ' These require color selections
- HoldColorIndex = 99
- frmColSelect.SHOW
- frmColSelect.cmdColor(Tmp).SETFOCUS
- EXIT SUB
- CASE 7
- Prompt$ = "Enter ASCII value (0-255) for desktop fill character"
- Title$ = "Desktop Fill Character"
- Defalt$ = STR$(Tmp)
- DO
- Tmp = VAL(INPUTBOX$(Prompt$, Title$, Defalt$))
- LOOP UNTIL Tmp >= 0 AND Tmp < 256
- CtrlChanged = TRUE
- CASE 3, 15
- Tmp = NOT Tmp
- CtrlChanged = TRUE
- END SELECT
- Screen.ControlPanel(CtrlIndx) = Tmp
- cmdSelUpdate.Enabled = CtrlChanged
- OutputSaved = NOT CtrlChanged
- END SUB
-
- SUB cmdSelUpdate_Click ()
- ' Update the control file with the Control Panel
- ' settings
- CALL UpdateCtrlData
- END SUB
-
- SUB Form_Load ()
- LOAD frmColSelect ' get the color select form
- 'Fill the first drop down box array
- FOR i = 0 TO 17
- SELECT CASE i
- CASE 0
- Tmp$ = "Access key foreground color "
- CASE 1
- Tmp$ = "Active border background color "
- CASE 2
- Tmp$ = "Active border foreground color "
- CASE 3
- Tmp$ = "Active window shadow effect "
- CASE 4
- Tmp$ = "Command-button foreground color "
- CASE 5
- Tmp$ = "Desktop background color "
- CASE 6
- Tmp$ = "Desktop foreground color "
- CASE 7
- Tmp$ = "Desktop fill pattern (ASCII 0-255)"
- CASE 8
- Tmp$ = "Disabled menu/dialog foregrd color "
- CASE 9
- Tmp$ = "Menu background color "
- CASE 10
- Tmp$ = "Menu foreground color "
- CASE 11
- Tmp$ = "Menu item selected backgrd color "
- CASE 12
- Tmp$ = "Menu item selected foregrd color "
- CASE 13
- Tmp$ = "Scroll bar background color "
- CASE 14
- Tmp$ = "Scroll bar foreground color "
- CASE 15
- Tmp$ = "3-D effect for control borders "
- CASE 16
- Tmp$ = "Title bar background color "
- CASE 17
- Tmp$ = "Title bar foreground color "
- END SELECT
- cboControls.ADDITEM Tmp$
- NEXT i
-
-
- ' Get the Control Panel file, if it exists, and use
- ' the values that were stored last time.
- ' If it does not exist then it must be created, ask
- ' user if the file is to be created
- FileOpen = TRUE
- ON LOCAL ERROR GOTO NoFileFound
-
- OPEN "ctrlpanl.opt" FOR INPUT AS #10
- ' The values are in the file, use them first
- ' and load to ControlPanel also
- FOR i = 0 TO 17
- IF FileOpen THEN
- INPUT #10, PMCtrl
- Screen.ControlPanel(i) = PMCtrl
- END IF
- Tmp$ = STR$(Screen.ControlPanel(i))
- NEXT i
- CLOSE (10)
- HoldColorIndex = 99 ' default
- ' Center Justify the form on the screen
- CtrlPanl.Left = (Screen.Width - CtrlPanl.Width) \ 2
- CtrlPanl.Top = (Screen.Height - CtrlPanl.Height) \ 2
- EXIT SUB
-
- NoFileFound:
- ' Open failed on input, set a switch to bypass reads
- FileOpen = FALSE
- RESUME NEXT
-
- END SUB
-
- SUB UpdateCtrlData ()
- ' Save the changes made to the Screen Controls
- OPEN "ctrlpanl.opt" FOR OUTPUT AS #10
- FOR i = 0 TO 17
- PMCtrl = Screen.ControlPanel(i)
- PRINT #10, PMCtrl
- NEXT i
- OutputSaved = TRUE
- CLOSE (10)
- ' Change Cancel Button to Done
- CtrlChanged = FALSE
- cmdSelUpdate.Enabled = FALSE
- cmdSelCancel.Caption = "&Done"
- cmdSelCancel.SETFOCUS
- END SUB
-
-